import inspect
import sys,os,time,json
p=os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))))
p=os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(p))))
p=p+os.sep+'_base_tool'+os.sep+'python'
sys.path.append(p)
from base_class1_0 import base_class # type: ignore

class mqtt_class(base_class):
    def run(self,page_config,**kwargs):   
        print('json:',json)
        if headers=='':headers=None
        elif isinstance(headers,str):headers=JSON.loads(headers)
        if json=='':json=None
        elif isinstance(json,str):json=JSON.loads(json.strip())
        full_url = url +('?'+params if params else '')
        response=self.requests[method](url=full_url,headers=headers,json=json)
        res={}
        try:
            res['json']=response.json()
        except:pass
        res['text']=response.text
        return res
    